package cn.ltgodm.moj.controller;

import cn.ltgodm.moj.model.entity.Question;
import cn.ltgodm.moj.model.entity.QuestionSubmit;
import cn.ltgodm.moj.service.QuestionFeignClient;
import cn.ltgodm.moj.service.QuestionService;
import cn.ltgodm.moj.service.QuestionSubmitService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ltgodm
 * @date 2024-03-13 22:48:57
 */
@RestController
public class QuestionInnerController implements QuestionFeignClient {
    @Resource
    QuestionService questionService;
    @Resource
    QuestionSubmitService questionSubmitService;
    @GetMapping("/inner/get")
    public Question getQuestionById(@RequestParam Long questionId) {
        return questionService.getById(questionId);
    }


    @PostMapping("/inner/update")
    public boolean updateQuestionById(@RequestBody Question question){
        return questionService.updateById(question);
    }

    @GetMapping("/submit/inner/get")
    public QuestionSubmit getQuestionSubmitById(@RequestParam Long questionSubmitId){
        return questionSubmitService.getById(questionSubmitId);
    }


    @PostMapping("/submit/inner/update")
    public boolean updateQuestionSubmitById(@RequestBody QuestionSubmit questionSubmit){
        return questionSubmitService.updateById(questionSubmit);
    }
}
